/*
 * resultAmp.java
 *
 * Created on 31 de Mar�o de 2008, 10:00
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package br.com.cpqd.ssar.posprocessamento;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Vector;

/**
 *
 * @author igor
 */
public class readingFileFftGraph {
    
    private BufferedReader br;
    private FileInputStream is;
    private Vector vTempo = new Vector();
    private Vector vAmp = new Vector();
    private float maxY = 0;     //maxY serve para verificar qual campo � maior
    private float minY = 0;
    private float cont = 0;
    
    /** Creates a new instance of resultAmp */
    // recebe o nome do arquivo como parametro
    public readingFileFftGraph(String file) throws IOException {
        try {
            
            
            is = new FileInputStream(file);
            br = new BufferedReader(new InputStreamReader(is));
            String s;
            
            /* L� a amplitude, define qual � a maior e qual � a menor
             * E para cada amplitude � adicionada uma unidade no eixo X
             
             */
            
            while ( (s = br.readLine()) != null || (s == " ") ){
                
                if(maxY < Float.valueOf(s))
                    maxY = Float.valueOf(s);
                
                if(minY > Float.valueOf(s) )
                    minY = Float.valueOf(s);
                
                vAmp.add(Float.valueOf(s));
                vTempo.add(cont);
                cont++;
                
            }
            
            is.close();
            br.close();
            
            
        } catch (FileNotFoundException ex) {
            ex.printStackTrace();
        }
        
        
    }
    
    public Vector getvTempo(){
        return vTempo;
    }
    
    public Vector getvAmp(){
        return vAmp;
    }
    
    public float getYMax(){
        return maxY;
        
    }
    
    public float getYMin(){
        return minY;
    }
    
}
